import { httpRequest } from '../httpRequest'
import _ from 'lodash';
export default {


  // 数据融合
  // /batch/together

  // {
  //     "uniformColor":"不匀色",//匀色方式
  //     "batchId":["140"],//batchId
  //     "blankFilling":"不补齐"//补齐方式
  // }

  batchTogether(params) {
    return httpRequest.post(`/batch/together`, params)
  },

  // 数据解析
  // /batch/analyse/{batchId}
  getbatchAnalyse(batchId) {
    return httpRequest.get(`/batch/analyse/${batchId}`)
  },


  // 镶嵌线保存
  // {
  //     "lineStyle":"1111111111111111"
  // }
  setlineType(params) {
    return httpRequest.put(`/lineType`, params)
  },

  // 镶嵌线获取
  getlineType() {
    return httpRequest.get(`/lineType`)
  },


  // 文件下载
  // /distribute/downfile
  /**
   {
        "taskName":"任务111",//分幅名字
        "pathList":["D:\\gztx_yxrh\\service_distribution\\2024\\10\\28\\t1_20241028152406A002"]//tif路径
    }
   * @returns 
   */

  distributeDownfile(params){
    return httpRequest.post(`/distribute/downfile`, params,
    {
      responseType: "blob",
    }
    )
  },


  // 服务分发记录文件列表
  // /distribute/file/{distributeId}
  getDistributeListFile( distributeId) {
    return httpRequest.get(`/distribute/file/${distributeId}`)
  },
  
  
  // 服务分发列表
  /**
   * /distribute/list?pageSize=10&pageNum=1
   * @param {*} pageSize 
   * @param {*} pageNum 
   * @returns 
   */
  getDistributeList(pageSize, pageNum) {
    return httpRequest.get(`/distribute/list?pageSize=${pageSize}&pageNum=${pageNum}`)
  },
  
  
  
  // 新增服务分发记录
  /**
   {
      "taskName": "任务2",//任务名
      "levels": "12",//层级
      "divideType": "不分割",//分隔方式
      "regionalRange": "",//区域范围
      "projectionMode": "经纬度",//投影方式
      "outputFormat": "GeoTiff",//输出格式
      "timeRange": "2024-10-01 - 2024-10-11",//时间范围
      "timeDivide": "不分割"//时间分隔
    }
   * @param {*} params 
   * @returns 
   */
  createDistribute(params) {
    return httpRequest.post(`/distribute`, params)
  },
  
  
  // 图幅号分幅

  /**
   * 
   
   {
      "sheetsNum": ["H48I105147","H48I105148"]
      "type": 0,
      "scale": 2
    }
    
   * @param {*} params 
   * @returns 
   */

  getFramingSheet(params) {
    return httpRequest.post(`/framing/sheet`, params)
  },

  // 获取国标军标分幅
  /**
   * 
   * {
        "geojson": "{\"features\":[{\"geometry\":{\"coordinates\":[[[[103.5255,31.2727],[103.6888,31.161],[103.7415,30.9722],[103.7409,30.8369],[103.6583,30.8059],[103.6478,30.8487],[103.667,30.9145],[103.6676,31.0151],[103.6416,31.0908],[103.6254,31.1597],[103.5969,31.1902],[103.5596,31.2255],[103.5596,31.2262],[103.5255,31.2727]]]],\"type\":\"MultiPolygon\"},\"id\":\"test.1\",\"type\":\"Feature\",\"properties\":{}},{\"geometry\":{\"coordinates\":[[[[104.6156,31.3535],[104.8395,31.3869],[104.8408,31.3869],[104.9064,31.3162],[104.9977,31.1669],[105.0428,31.0061],[105.0556,30.6716],[104.9746,30.4645],[104.8176,30.3705],[104.5886,30.4567],[104.7674,30.6098],[104.9373,30.9058],[104.8459,31.0357],[104.734,31.1309],[104.6336,31.1386],[104.6195,31.0717],[104.6118,31.0087],[104.6465,30.8672],[104.4857,31.0949],[104.6156,31.3535]]]],\"type\":\"MultiPolygon\"},\"id\":\"test.2\",\"type\":\"Feature\",\"properties\":{}}],\"crs\":{\"type\":\"name\",\"properties\":{\"name\":\"urn:ogc:def:crs:OGC:1.3:CRS84\"}},\"name\":\"test\",\"type\":\"FeatureCollection\"}",
        "type": "guobiao", //guobiao   junbiao
        "scale": "9"
    }
   * @returns 
   */
  getFramingMeans(params) {
    return httpRequest.post(`/framing/means`, params)
  },

  // 获取瓦片文件列表
  /**
   * /file/batch/{batchVersion}
   * @returns 
   */
  getFileBatch(batchVersion) {
    return httpRequest.get(`/file/batch/${batchVersion}`)
  },

  // 根据坐标获取镶嵌线信息 
  /**
   * /line/attribute?lon=121.017912&lat=24.992891
   * @returns 
   */
  getLineAttribute(lon, lat, level) {
    return httpRequest.get(`/line/attribute?lon=${lon}&lat=${lat}&level=${level}`)
  },

  // 获取瓦片列表
  /**
  {
      "timeRange": "2018-08-01:2019-07-10",//时间范围（:分隔）
      "sensor": "WV02,GE01",//传感器（,分隔）
      "wxName": "卫星",//卫星名称
      "sunCorner": "",//太阳角
      "geojson": [
          "121.268038 24.706764,121.413084 24.706270,121.412428 24.555461,121.245265 24.555650,121.268038 24.706764",
          "121.268038 24.706764,121.413084 24.706270,121.412428 24.555461,121.250265 24.555650,121.268038 24.706764"
      ],//矩形框四角点
      "shpPath": "",//矢量文件导入
      "level": ""//分辨率
  }
   */
  getLineSearch(params) {
    return httpRequest.post(`/line/search`, params)
  },

  /**
   * 
    {
        "geojson": [
            "121.268038 24.706764,121.413084 24.706270,121.412428 24.555461,121.245265 24.555650,121.268038 24.706764"
        ],//矩形框四角点
        "level": ""//层级
    }
   * @returns 
   */
  getMapServerTimebase(params) {
    return httpRequest.post(`/mapServer/timebase`, params)
  },

  // 根据id获取单个镶嵌线
  getLineLiID(lineId) {
    return httpRequest.get(`/line/${lineId}`)
  },

  // 获取瓦片列表
  getLineList(params1) {
    let params = {
      pageSize: 10,
      pageNum: 1,
    }
    _.has(params1, 'pageSize') ? params.pageSize = params1.pageSize : ""
    _.has(params1, 'pageNum') ? params.pageNum = params1.pageNum : ''
    _.has(params1, 'lineVersion') ? params.lineVersion = params1.lineVersion : ''
    return httpRequest.get(`/line/list?lineVersion=${params.lineVersion}&pageSize=${params.pageSize}&pageNum=${params.pageNum}`)
  },

  // 获取传感器类型
  getAttributeSensor(params) {
    return httpRequest.get(`/attribute/sensor`)
  },

  // 扫描文件夹数据 
  getFileScan(params) {
    return httpRequest.get(`/file/scan`)
  },

  // 新增扫描记录
  /*
  {
    "dataSource": "卫星一号",//数据来源
    "blankFilling": "不补齐",//补齐方式
    "uniformColor": "无",//匀色方式
    "scanPath": "\\primary_data\\db",//扫描路径
    "projectionMode": "3857",//4326:经纬度   3857:墨卡托 
    "batchFormat":"db"//瓦片版本
  }*/
  postBatch(params) {
    // return httpRequest.post('/py/shpInfo', params)
    return httpRequest.post('/batch', params)
  },

  // 获取瓦片列表
  //  /batch/list?pageSize=10&pageNum=1
  getBatchList(pageSize = 10,pageNum = 1) {
    return httpRequest.get(`/batch/list?pageSize=${pageSize}&pageNum=${pageNum}`)
  },

  // 获取镶嵌线数据
  //  /line/data?batchId=33
  getLineData(id) {
    return httpRequest.get(`/line/data?batchId=${id}`)
  },




  // 瓦片服务
  // http://localhost:8346/mapServer/tile/{z}/{x}/{y}


}
